<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/pages/common/component.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新增转账记录</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<script type="text/javascript">

// 返回账户列表
function back2list(){
	if(confirm("数据没有保存!确认将丢失当前表单数据!")){
		window.location.href = "transferAccountAction.do?method=list"
	}else{
		return ;
	}
}

$(document).ready(function() {
	// 创建时间
	configDate('transferDate', '<fmt:formatDate value="<%=new Date() %>" pattern="yyyy-MM-dd" type="date"/>', 'yy-mm-dd');
    // 校验主表单
    $("#transferAccountForm").validationEngine();
});

function checkTransferAccount(){
	var fromAccountId = $("#fromAccountId");
	var toAccountId = $("#toAccountId");
	if(fromAccountId.val() == toAccountId.val()){
		return "转入账户和转出账户不能相同!";
	}
}

</script>	
	
</head>
  
  <body>
   
   <html:form method="post" styleId="transferAccountForm" action="transferAccountAction.do">
    <input type="hidden" name="method" value="insert"/>
    <br/><br/><br/><br/>
    <table width="40%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
		<tr align="center" bgcolor="#FAFAF1" height="22">
			<td colspan="2"><b>新增转账</b></td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="10%">转出账户</td>
			<td width="30%">
				<select class="validate[required,funcCall[checkTransferAccount]]" id="fromAccountId" name="fromAccountId" style="width:80%" >
					<c:forEach var="ownAccountVO" items="${lstAccountVOs }">
						<c:if test="${ownAccountVO.pubUser.userId == objLoginUser.userId}">
						 <option value="${ownAccountVO.accountId }">${ownAccountVO.accountName }:${ownAccountVO.amount }</option>
						</c:if>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="10%">转入账户</td>
			<td width="30%">
				<select class="validate[required,funcCall[checkTransferAccount]]" id="toAccountId" name="toAccountId" style="width:80%">
					<c:forEach var="accountVO" items="${lstAccountVOs }">
						<option value="${accountVO.accountId }">${accountVO.pubUser.name }:${accountVO.accountName }</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td>金额</td>
			<td>
				<input class="validate[required,custom[number]]" id="amount" name="amount" style='width:30%;'/>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td>手续费</td>
			<td>
				<input class="validate[custom[number]]" id="handFee" name="handFee" style='width:30%;'/>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td>转账日期</td>
			<td>
				<input id="transferDate" name="transferDate" style='width:30%;' readonly/>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td>备注</td>
			<td>
				<input name="note" style='width:30%;'/>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<html:submit value="提交"></html:submit>
				&nbsp;&nbsp;&nbsp;
				<input type="button" value="返回" onclick="back2list();"> 
			</td>
		</tr>
    </table>
   </html:form> 
    
  </body>
</html>
